﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 图片查看器
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            path = Directory.GetFiles(@"C:\Users\Public\Pictures\Sample Pictures","*.jpg");
            pictureBox1.Image = Image.FromFile(path[i]);
            
        }

        string[]path;
        int i = 0;
        private void button_PreOne_Click(object sender, EventArgs e)
        {
            i--;
            if (i == -1)
            {
                i = path.Length-1;
            }
            pictureBox1.Image = Image.FromFile(path[i]);
        }

        private void button_BackOne_Click(object sender, EventArgs e)
        {
            i++;
            if (i == path.Length)
            {
                i = 0;
            }
            pictureBox1.Image = Image.FromFile(path[i]);
        }
    }
}
